<?php

class Utilisateur extends BaseObject {
	
	private $idGroupe;
	private $login;
	private $password;
	private $mail;
	/**
	 * @ManyToOne
	 * @JoinColumn(name="idGroupe",className="Groupe")
	 */
	private $groupe;
	
	/**
	 * @ManyToMany(targetEntity="Application", inversedBy="application")
	 * @JoinTable(name="affectation")
	 */
	private $application;
	
	/**
	 * @OneToMany(mappedBy="utilisateur",className="Message")
	 */
	private $message;
	
	public function __construct($id="",$idGroupe="",$password="",$login=""){
		if($id=="")
		{
		parent::__construct($id="");
		}
		else
		{
			parent::__construct($id);
		}
		$this->login= $login;
		$this->password=$password;
		$this->idGroupe=$idGroupe;
	}
	
	public function getIdGroupe() {
		return $this->idGroupe;
	}
	
	public function setIdGroupe($idGroupe) {
		$this->idGroupe = $idGroupe;
		return $this;
	}
	
	
	public function getLogin() {
		return $this->login;
	}
	
	public function setLogin($login) {
		$this->login = $login;
		return $this;
	}
	
	public function getPassword() {
		return $this->password;
	}
	
	public function setPassword($password) {
		$this->password = $password;
		return $this;
	}
	
	public function getGroupe() {
		return $this->groupe;
	}
	
	public function setGroupe($groupe) {
		$this->groupe = $groupe;
		return $this;
	}
	public function toString(){
		$groupe=$this->groupe;
		if(!isset($groupe))
			$groupe='Sans groupe';
		else 
			$groupe=$groupe->getLibelle();
		return $this->login." (".$groupe.")";
	}

	public function getMail() {
		return $this->mail;
	}
	
	public function setMail($mail) {
		$this->mail = $mail;
		return $this;
	}

	public function getId() {
		return $this->id;
	}
	
	public function setId($id) {
		$this->id = $id;
		return $this;
	}
	
	public function getApplication() {
		return $this->affectation;
	}
	
	public function setApplication($affectation) {
		$this->affectation = $affectation;
		return $this;
	}
	
	
}